<?php

$event = $this->event;

foreach($this->vote_info as $thread_id=>$thread){
    if(count($thread) >= 1){
        foreach($thread as $phase_id=>$phase){         
            $voteVideoArr = array();
            if($phase->view_enable ==1 && isset($this->videoList[$phase->thid][$phase->pid])
            && is_array($this->videoList[$phase->thid][$phase->pid]) 
            && count($this->videoList[$phase->thid][$phase->pid])>0
            && $phase->vote_type == EVENT_VIDEO_VOTE){
                $voteVideoArr = $this->videoList[$phase->thid][$phase->pid];

                $video_block_id = $thread_id."_".$phase_id;
                $video_block_title = $phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");
                $bgImg = "header-small-".$thread_id.'-'.$phase_id.".png";
?>
            <!--video:-->
                <a name="mark_video_<?=$video_block_id?>"></a>
                <div id="video" class="event-area">
                    <div class="event-header-long">
                        <?php
                        $href = "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
                        if($phase->votephoto_category > 0){
                            $href = 'http://video.tamtay.vn/category/'.$phase->votephoto_category;
                        }
                            
                        ?>
                        <span class="value">
				<a href="<?=$href?>" title="<?=$video_block_title?>">
					<?=$video_block_title;?>
					<!--<img alt="<?=$video_block_title?>" src="<?php echo $this->spath;?>/images/<?=$bgImg?>">-->
				</a></span>      </div>
                          <div class="event-content-long" style="padding-left:40px;">
                        <!--video Content-->
                        <?php if(is_array($voteVideoArr) && count($voteVideoArr)>0){?>
                        <ul class="photo-group" style="margin-top:10px;">
                        <?php 
                            for($i=0; $i<count($voteVideoArr) && $i<4; $i++){
                                $videoObj = $voteVideoArr[$i];
                                $thumbnail = VIDEO_THUMBNAIL_SERVER.'/'.$videoObj->image_preview;
                            ?>
                            <li class="photo-item">
                                <div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                            <img src="<?=$thumbnail;?>"  onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                    <?php echo $videoObj->title;?>
                                </a>
                            </li>
                        <?php 
                            }    // End of for
                        ?>
                        </ul>
                        <?php } // End of if?>
                        <?php if(is_array($voteVideoArr) && count($voteVideoArr)>4){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=4; $i<count($voteVideoArr) && $i<8; $i++){
                                $videoObj = $voteVideoArr[$i];
                                $thumbnail = VIDEO_THUMBNAIL_SERVER.'/'.$videoObj->image_preview;
                            ?>
                            <li class="photo-item<?php echo $i==4?" clear-left":""; ?>">
                                <div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                            <img src="<?=$thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                    <?php echo $videoObj->title;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                            
                        <?php } // End of if?>
                        <?php if(is_array($voteVideoArr) && count($voteVideoArr)>8){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=8; $i<count($voteVideoArr) && $i<12; $i++){
                                $videoObj = $voteVideoArr[$i];
                                $thumbnail = VIDEO_THUMBNAIL_SERVER.'/'.$videoObj->image_preview;
                            ?>
                            <li class="photo-item<?php echo $i==8?" clear-left":""; ?>">
                                <div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                            <img src="<?=$thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                    <?php echo $videoObj->title;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                            
                        <?php } // End of if?>
                        <?php if(is_array($voteVideoArr) && count($voteVideoArr)>12){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=12; $i<count($voteVideoArr) && $i<16; $i++){
                                $videoObj = $voteVideoArr[$i];
                                $thumbnail = VIDEO_THUMBNAIL_SERVER.'/'.$videoObj->image_preview;
                            ?>
                            <li class="photo-item<?php echo $i==12?" clear-left":""; ?>">
                                <div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                            <img src="<?=$thumbnail;?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                    <?php echo $videoObj->title;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                            
                        <?php } // End of if?>
                        <?php if(is_array($voteVideoArr) && count($voteVideoArr)>16){?>
                        <ul class="photo-group">
                        <?php 
                            for($i=16; $i<count($voteVideoArr) && $i<20; $i++){
                                $videoObj = $voteVideoArr[$i];
                                $thumbnail = VIDEO_THUMBNAIL_SERVER.'/'.$videoObj->image_preview;
                            ?>
                            <li class="photo-item<?php echo $i==16?" clear-left":""; ?>">
                                <div class="wrapEventNew01" style="float:left; margin-bottom: 5px;">
                                    <div class="wrapEventNew02">
                                        <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                            <img src="<?=$thumbnail?>" onload="resizeImage(this,125, 100)" />
                                        </a>
                                    </div>
                                </div>
                                <a href="http://video.tamtay.vn/play/<?php echo $videoObj->vid;?>" target="_blank">
                                    <?php echo $videoObj->title;?>
                                </a>
                            </li>
                        <?php 
                            } // End of for
                        ?>
                        </ul>
                            
                        
                        <?php } ?>
                        <div class="clear"></div>

                        <!--End Photo Content-->
                            <div class="text-right viewmore"><a href="<?php
                            if($phase->votephoto_category > 0)
                                echo 'http://photo.tamtay.vn/category/browse/'.$phase->votephoto_category;
                            else 
                                echo "/event/".$event->short_cut."/votedlist/".$thread_id."/".$phase_id;
                                ?>">Xem tiếp &raquo;</a></div>
                        </div>
                </div>
                <!--End video-->
                
<?php 
            }
        }
    }
    
} ?>